cmake_minimum_required(VERSION 3.16)
project(asio)

set(CMAKE_CXX_STANDARD 11)

set(ASIO_STANDALONE On) #always no depends boost

set(ASIO_DYN_LINK On)

if (ASIO_STANDLONE)
    add_definitions(-DASIO_STANDLONE)
endif (ASIO_STANDLONE)

if (ASIO_DYN_LINK)
    add_definitions(-DASIO_DYN_LINK)
endif (ASIO_DYN_LINK)

set (prefix ${CMAKE_INSTALL_PREFIX})
set (exec_prefix \${prefix})
set (libdir \${exec_prefix}/lib)
set (datarootdir \${prefix})
set (datadir \${datarootdir})
set (includedir \${prefix}/include)
set (top_srcdir .)

if (ASIO_DYN_LINK)
    configure_file (asio-shared.pc.in asio.pc @ONLY)
else (ASIO_DYN_LINK)
    configure_file (asio.pc.in asio.pc @ONLY)
endif (ASIO_DYN_LINK)


add_subdirectory(include)
enable_testing()
add_subdirectory(src)

install (FILES "${CMAKE_CURRENT_BINARY_DIR}/asio.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")

# if SEPARATE_COMPILATION
# noinst_LIBRARIES = libasio.a
# libasio_a_SOURCES = ../../asio.cpp
# if HAVE_OPENSSL
# libasio_a_SOURCES += ../../asio_ssl.cpp
# endif
# LDADD = libasio.a
# endif
